<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@ page import="com.study.system.user.domain.User" %>
<%@taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" deferredSyntaxAllowedAsLiteral="true" %>
<html>
<head>
    <meta charset="UTF-8">
    <title>打卡系统</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/bootstrap.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/bootstrap-theme.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/bootstrap-admin-theme.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/bootstrap-admin-theme.css">

    <script src="${pageContext.request.contextPath}/static/js/bootstrap.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/js/bootstrap-dropdown.min.js"></script>
    >


</head>
<%--导入js--%>
<script src="${pageContext.request.contextPath}/static/js/axios-0.18.0.js"></script>

<script src="${pageContext.request.contextPath}/static/js/bootstrap.min.js"></script>


<body class="bootstrap-admin-with-small-navbar">
<%@include file="user_header.jsp" %>
<div class="container">
    <div class="row">
        <%@include file="user_means.jsp" %>
        <div class="container">
            <!-- left, vertical navbar & content -->
            <div class="row">
                <div class="col-md-10">
                    <div class="row">
                        <div class="col-lg-12">
                            <div class="panel panel-default">
                                <div class="panel-heading">
                                    <div class="text-muted bootstrap-admin-box-title" style="text-align: center">
                                        打卡管理系统
                                    </div>
                                </div>
                                <div class="bootstrap-admin-panel-content">
                                    <ul>
                                        <li><input id="xiaban" name="xiaban" value="打卡上班" type="button" onclick="aa()">
                                        </li>
                                        <br>
                                        <li><input id="shangban" name="shangban" value="打卡下班" type="button"
                                                   onclick="bb()"></li>
                                        <br>
                                    </ul>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>

    <script>
        // 上班打卡函数
        function aa() {
            // 将表单数据转为json
            var formData = {
                id:${user.id},
                status: 1,
            };
            axios({
                method: "POST",
                url: "${pageContext.request.contextPath}/log/addLog",
                data: formData
            }).then(function (resp) {
                if (resp.data = true) {
                    alert("上班打卡成功!!!")
                }
            })
        }
    </script>

    <script>
        // 下班打卡函数
        function bb() {
            // 将表单数据转为json
            var formData = {
                id:${user.id},
                status: 2,
            };
            axios({
                method: "POST",
                url: "${pageContext.request.contextPath}/log/addLog",
                data: formData
            }).then(function (resp) {
                if (resp.data = true) {
                    alert("下班打卡成功!!!")
                }
            })
        }
    </script>
</div>
</body>
</html>